import { createRouter,createWebHistory,RouteRecordRaw } from "vue-router"
import Login from "@/views/Login.vue"
import Register from "@/views/Register.vue"
import Home from "@/views/Home.vue"

const routes:Array<RouteRecordRaw> = [
    {
        path:"/login",
        name:"Login",
        component:Login
    },
    {
        path:"/register",
        name:"Register",
        component:Register
    },
    {
        path:"/",
        name:"Home",
        component:Home,
        children:[
            {
                path:"/home",
                name:"Main",
                component:()=>import("@/views/subs/Main.vue")
            },
            {
                path:"/system/user",
                name:"User",
                component:()=>import("@/views/subs/User.vue")
            },
            {
                path:"/system/role",
                name:"Role",
                component:()=>import("@/views/subs/Role.vue")
            },
            {
                path:"/gen/apply/charge",
                name:"ChargeApply",
                component:()=>import(`@/views/subs/ChargeApply.vue`)
            }
        ]
    },
    // 配置页面404
    {
        path: '/:pathMatch(.*)',
        component: () => import ('@/views/NotFind.vue')
    },
]

const router = createRouter({
    routes,
    //history设置路由模式
    history:createWebHistory()
})

export default router